<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改菜单')" />

</head>
<body class="gray-bg">
<div class="row animated fadeInRight">
    <div class="ibox float-e-margins">
        <style type="text/css">
            .btn{
                margin-right: 10px;
            }
        </style>

        <div id="ibox-content">
            <div id="vertical-timeline" class="vertical-container dark-timeline">
                <div class="vertical-timeline-block">
                    <div class="vertical-timeline-icon navy-bg">
                        <i class="fa fa-hand-stop-o"></i>
                    </div>

                    <div class="vertical-timeline-content">
                        <h2>报名</h2>
                        <p>开启学生申报卓越班功能。</p>
                        <button id="close-baoMing"  class="btn btn-default " type="button" disabled="disabled"><i class="fa fa-check"></i>&nbsp;已开启</button>
                        <button id="open-baoMing" class="btn btn-primary " type="button" ><i class="fa fa-circle-o"></i>&nbsp;开启</button>
                        <button id="detail-baoMing" class="btn btn-warning " type="button"><i class="fa fa-warning"></i> <span class="bold">详细内容</span></button>
                    </div>
                </div>

                <div class="vertical-timeline-block">
                    <div class="vertical-timeline-icon blue-bg">
                        <i class="fa fa-file-text"></i>
                    </div>

                    <div class="vertical-timeline-content">
                        <h2>测试</h2>
                        <p>开启面试，机试选拔及面试机试成绩录入功能。</p>
                        <button id="close-ceShi"  class="btn btn-default " type="button" disabled="disabled"><i class="fa fa-check"></i>&nbsp;已开启</button>
                        <button id="open-ceShi" class="btn btn-primary " type="button"><i class="fa fa-circle-o"></i>&nbsp;开启</button>
                        <button id="detail-ceShi" class="btn btn-warning " type="button"><i class="fa fa-warning"></i> <span class="bold">详细内容</span></button>
                    </div>
                </div>

                <div class="vertical-timeline-block">
                    <div class="vertical-timeline-icon lazur-bg">
                        <i class="fa fa-television"></i>
                    </div>

                    <div class="vertical-timeline-content">
                        <h2>卓越班选拔</h2>
                        <p>开启卓越班选拔和对接导师功能。</p>
                        <button id="close-daoShi"  class="btn btn-default " type="button" disabled="disabled"><i class="fa fa-check"></i>&nbsp;已开启</button>
                        <button id="open-daoShi" class="btn btn-primary " type="button"><i class="fa fa-circle-o"></i>&nbsp;开启</button>
                        <button id="detail-daoShi" class="btn btn-warning " type="button"><i class="fa fa-warning"></i> <span class="bold">详细内容</span></button>
                    </div>
                </div>

                <div class="vertical-timeline-block">
                    <div class="vertical-timeline-icon yellow-bg">
                        <i class="fa fa-tripadvisor"></i>
                    </div>

                    <div class="vertical-timeline-content">
                        <h2>课题报告</h2>
                        <p>开启可以报告管理及成立录入功能。</p>
                        <button id="close-keTi"  class="btn btn-default " type="button" disabled="disabled"><i class="fa fa-check"></i>&nbsp;已开启</button>
                        <button id="open-keTi" class="btn btn-primary " type="button"><i class="fa fa-circle-o"></i>&nbsp;开启</button>
                        <button id="detail-keTi" class="btn btn-warning " type="button"><i class="fa fa-warning"></i> <span class="bold">详细内容</span></button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer" />
<script>
    var stage =[[${stage}]];
    $(function() {
        $(".btn-default").hide();
        if(stage == 1){
            $("#close-baoMing").show();
            $("#open-baoMing").hide();
        }
        if(stage == 2){
            $("#close-ceShi").show();
            $("#open-ceShi").hide();
        }
        if(stage == 3){
            $("#close-daoShi").show();
            $("#open-daoShi").hide();
        }
        if(stage == 4){
            $("#close-keTi").show();
            $("#open-keTi").hide();
        }
    });
    //点击开启按钮
    $("#open-baoMing").click(function(){
        stage=1;
        updtestage(stage);
        $(".btn-default").hide();
        $(".btn-primary").show();
        $("#open-baoMing").hide();
        $("#close-baoMing").show();
        processEdit();
    });
    $("#open-ceShi").click(function(){
        stage=2;
        updtestage(stage);
        $(".btn-default").hide();
        $(".btn-primary").show();
        $("#open-ceShi").hide();
        $("#close-ceShi").show();
        processEdit();
    });
    $("#open-daoShi").click(function(){
        stage=3;
        updtestage(stage);
        $(".btn-default").hide();
        $(".btn-primary").show();
        $("#open-daoShi").hide();
        $("#close-daoShi").show();
        processEdit();
    });
    $("#open-keTi").click(function(){
        stage=4;
        updtestage(stage);
        $(".btn-default").hide();
        $(".btn-primary").show();
        $("#open-keTi").hide();
        $("#close-keTi").show();
        processEdit();
    });

    function updtestage(stage){
        var config = {
            type: "post",
            url: "/system/config/updateStage",
            dataType: "json",
            data: {
                stage: stage
            },
        };
        $.ajax(config);
    }

    function processEdit(){
        var config = {
            type: "post",
            url: "/system/menu/processEdit",
            dataType: "json",
            data: {
                stage: stage
            },
            beforeSend: function () {

                $.modal.loading("正在处理中，请稍后...");
            },
            success: function (result) {
                $.modal.alertSuccess(result.msg);
                Notice();
                $.modal.closeLoading();
            }
        };
        $.ajax(config);
    }

    function Notice(){
        $.modal.confirm("是否要发布公告通知学生", function() {
            $.modal.openFull("新建公告", "/system/notice/add");
        });
    }
</script>

</body>
</html>
